//
//  EmotionsViewController.swift
//  FaceIt
//
//  Created by 袁培超 on 2017/6/16.
//  Copyright © 2017年 jason. All rights reserved.
//

import UIKit

class EmotionsViewController: VCLLoggingViewController {

    // MARK: - Navigation

    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
   
        var destinatinationController = segue.destination
        
        if let navigationController = destinatinationController as? UINavigationController {
            destinatinationController =  navigationController.visibleViewController ?? destinatinationController
        }
        
        if let faceViewController = destinatinationController as? FaceViewController,
            let identifier = segue.identifier,
            let expression = emotionalFaces[identifier] {
            faceViewController.expression = expression
            faceViewController.navigationItem.title = (sender as? UIButton)?.currentTitle
        }
    }
        
    
    private let emotionalFaces: Dictionary<String, FacialExpression> = [
        "sad": FacialExpression(eyes: .close, mouth: .frown),
        "happy": FacialExpression(eyes: .open, mouth: .smile),
        "worry": FacialExpression(eyes: .open, mouth: .smirk)
    ]

}

